import { FormSchema } from '/@/components/Form';

import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n('system.depart.fields');
const { t: depart } = useI18n('system.depart');
export const departFields = {
  departName: t('departName'),
  parentId: t('parentId'),
  orgCode: t('orgCode'),
  orgCategory: t('orgCategory'),
  departOrder: t('departOrder'),
  fax: t('fax'),
  address: t('address'),
  memo: t('memo'),
  mobile: t('mobile'),
};
// 部门基础表单
export function useBasicFormSchema() {
  const basicFormSchema: FormSchema[] = [
    {
      field: 'departName',
      label: departFields.departName,
      component: 'Input',
      componentProps: {
        placeholder: depart('departNameTip'),
      },
      rules: [{ required: true, message: depart('departNameTip') }],
    },
    {
      field: 'parentId',
      label: departFields.parentId,
      component: 'TreeSelect',
      componentProps: {
        treeData: [],
        placeholder: depart('notHave'),
        dropdownStyle: { maxHeight: '200px', overflow: 'auto' },
      },
    },
    {
      field: 'orgCode',
      label: departFields.orgCode,
      component: 'Input',
    },
    {
      field: 'orgCategory',
      label: departFields.orgCategory,
      component: 'RadioButtonGroup',
      componentProps: { options: [] },
    },
    {
      field: 'departOrder',
      label: departFields.departOrder,
      component: 'InputNumber',
      componentProps: {},
    },
    {
      field: 'mobile',
      label: departFields.mobile,
      component: 'Input',
    },
    {
      field: 'fax',
      label: departFields.fax,
      component: 'Input',
    },
    {
      field: 'address',
      label: departFields.address,
      component: 'Input',
    },
    {
      field: 'memo',
      label: departFields.memo,
      component: 'InputTextArea',
    },
  ];
  return { basicFormSchema };
}

// 机构类型选项
export const orgCategoryOptions = {
  // 一级部门
  root: [{ value: '1', label: depart('corporation') }],
  // 子级部门
  child: [
    { value: '2', label: depart('depart') },
    { value: '3', label: depart('post') },
  ],
};
